package at.fhooe.stefanirndorfer.effects;

import org.lwjgl.openal.AL11;
import org.lwjgl.openal.EFX10;

import at.fhooe.stefanirndorfer.sound.OpenALSource;

public class Reverb implements Effect {

	float decayTime; 


	
	public Reverb(float decayTime){
		this.decayTime = decayTime;
	}
	

	@Override
	public void useEffect(OpenALSource s) {
		final int effectSlot = EFX10.alGenAuxiliaryEffectSlots();
		final int reverbEffect = EFX10.alGenEffects();
		EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
        EFX10.alAuxiliaryEffectSloti(effectSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbEffect);
		AL11.alSource3i(s.getId(), EFX10.AL_AUXILIARY_SEND_FILTER, effectSlot, 0, EFX10.AL_FILTER_NULL);
	}

	public float getDecayTime() {
		return decayTime;
	}


	public void setDecayTime(float decayTime) {
		this.decayTime = decayTime;
	}


}
